1. Field of the Invention
The present invention relates to image processing apparatuses and methods, recording media and programs used therewith, and in particular, to an image processing apparatus and method suitable for use in the case of performing compression coding on moving picture data in accordance with the MPEG-4 (Moving Picture Experts Group-4) standard, and a recording medium and a program which are used therewith.
2. Description of the Related Art
The MPEG standards are widely used as methods for performing compression coding on digital moving picture data. In particular, the MPEG-4 standard that can perform coding at a compression ratio (e.g., 10 kbps to 2 Mbps) higher than conventional has attracted attention as a method for obtaining moving picture data in order to be supplied to so-called “mobile devices” such as cellular phones.
Similarly to the MPEG-2 standard, in the MPEG-4 standard, in the process of compression coding, an image is divided into macroblocks of a predetermined size, and motion vectors of the macroblocks are detected.
In all-motion search for detecting motion vectors of macroblocks, as shown in FIG. 1, for a frame image (hereinafter referred to as a “current frame”) to be compression-coded, a macroblock (MB) having a predetermined size (e.g., 16 by 16 pixels) is set, and block matching is performed between the macroblock and a search range set in a frame of reference. Specifically, in the search range, the block of reference, which is similar in size to the macroblock, is moved, and as is represented by the following expression:AD=Σ|c(i, j)−r(i, j)|where the sum AD (hereinafter referred to simply as the “AD”) of the absolute values of differences between pixel c(i, j) of the macroblock and each corresponding pixel r(i, j) in blocks of reference in the search range is calculated. The AD is detected as a motion vector (MV) in accordance with the position of the block of reference in a case in which the AD is the minimum.
There is a possibility that detection of a motion vector for each macroblock by using the above all-motion search cannot be applied to real-time coding because the number of calculations of ADs is extremely large.
Accordingly, the following hierarchical search for motion has been proposed as a method for detecting a motion vector of each macroblock. In the hierarchical search for motion, in first hierarchical processing, as FIG. 2 shows, a plurality of (e.g., four) macroblocks in a current frame are reduced in size at a predetermined magnification (¼) to generate a superblock (SB). By executing block matching for the superblock, a motion vector for the superblock is detected.
In second hierarchical processing, a motion vector for the superblock is extended at the predetermined magnification, and in a relatively narrow search range having the extended motion vector as a reference, motion vectors of the original macroblocks for the superblock are detected by the all-motion search or the like (see, for example, Published Japanese Translation No. 2002-518897 of PCT International Publication for Patent Application). In the hierarchical search for motion, the number of calculations of ADs can be reduced because, in the second hierarchical processing, a relatively narrow search range of the all-motion search can be set.
The second hierarchical processing in the hierarchical search for motion searches only a relatively narrow range based on vectors obtained by extending the superblock motion vector calculated in the first hierarchical processing.
Thus, the second hierarchical processing has a problem in that, depending on circumstances, a true motion vector for each macroblock may not be detected.
By way of example, it is assumed that true motion vectors for a plurality of (in this case, four) macroblocks constituting a superblock are as shown in FIG. 3A. In the first hierarchical processing, a motion vector for a superblock is detected as shown in FIG. 3B. The second hierarchical processing searches a relatively narrow range based on vectors as shown in FIG. 3C, obtained by extending the motion vector of the superblock. In this case, although it is considered that true motion vectors of macroblocks other than the bottom right macroblock in FIG. 3A are detected, an accurate true motion vector of the bottom right macroblock is not detected.
By expanding the search range in the second hierarchical processing, also for the bottom right macroblock in FIG. 3C, an accurate true macroblock can be detected. Nevertheless, the above manner increases the number of calculations of ADs. Thus, this is against the original purpose (decrease in the number of calculations of ADs) of the hierarchical search for motion.